import { defineComponent, ref } from 'vue'

import { useCounterStore } from '@/stores/counter'
import { Button } from 'ant-design-vue'

export default defineComponent({
  name: 'LoginCom',
  setup() {
    const counter = useCounterStore()
    console.log(counter, 'counter')
    const add = () => {
      // counter.increment()
      counter.$patch((state) => {
        console.log(state, 'state')

        state.count++
      })
    }
    return () => (
      <div>
        <span>登录</span>
        <span>count: {counter.count}</span>
        {/* <button onClick={add}>+</button> */}
        <Button type="primary" onClick={add}>
          +
        </Button>
      </div>
    )
  },
})
